import request from "./request";

interface ResultType<T> {
  code: number;
  message: string;
  data: T;
}
export function queryClass() {
  return request<[], ResultType<[]>>({
    url: '/class/all',
    method: 'get'
  });
}

interface classListParams {
  classname: string;
  pageSize: number;
  current: number;
}
export function queryClassList(params:classListParams) {
  interface classResult{
    total: number;
    classList: [];
  }
  return request<classResult, ResultType<classResult>>({
    url: '/class/list',
    method: 'get',
    params,
  })
}

export function addClass(classname: string) {
  return request<[], ResultType<[]>>({
    url: '/class/add',
    method: 'post',
    data: {
      classname
    }
  })
}

export function deleteClass(id:number) {
  return request<[], ResultType<[]>>({
    url: '/class/delete',
    method: 'post',
    data: {
      id
    }
  })
}
